Skip to content

ci: pin GitHub Actions to commit SHAs and add Dependabot - #32941

Open
jogerj wants to merge 1 commit into
iptv-org:masterfrom
jogerj:ci/pin-actions-dependabot
Open

ci: pin GitHub Actions to commit SHAs and add Dependabot#32941
jogerj wants to merge 1 commit into
iptv-org:masterfrom
jogerj:ci/pin-actions-dependabot

Conversation

@jogerj

@jogerj jogerj commented Sep 5, 2026

Copy link
Copy Markdown

What this does

Pins all 18 action references across the five workflows to full-length commit SHAs, and adds .github/dependabot.yml to keep those pins current.

No action changes version. Every SHA is the one its current tag already resolves to, verified against git ls-remote. This PR is a no-op at runtime; it only changes how the references are expressed.

Why pin to SHAs

Tags are mutable. @v4 is a pointer the action's maintainer — or anyone who compromises their repo — can move at any time, and your next workflow run silently executes different code.

This is not hypothetical. In March 2025, tj-actions/changed-files was compromised (CVE-2025-30066): the attacker retroactively repointed every tag from v1 through v45.0.7 at a malicious commit that dumped CI/CD secrets into workflow logs. Roughly 23,000 repositories were affected, and CISA issued an alert. Repos pinned to a SHA were unaffected, because a SHA cannot be repointed. Repos on floating tags were compromised without changing a line of their own code.

GitHub's own security hardening guide is unambiguous:

Pinning an action to a full-length commit SHA is currently the only way to use an action as an immutable release.

There is risk to this approach even if you trust the author, because a tag can be moved or deleted if a bad actor gains access to the repository storing the action.

Why it matters specifically here

This is not a repo where a compromised action would be a minor inconvenience:

  • deploy.yml and update.yml mint a GitHub App token from secrets.APP_PRIVATE_KEY.
  • update.yml runs with contents: write and pushes to master.
  • deploy.yml pushes to a second repository, iptv-org/api, using that app token.

Any action step running in those jobs sits next to a GitHub App private key with write access to two repos. Four of the six actions used here are third-party, and two of them (kforeverisback/check-crlf-extended, tibdex/github-app-token) are small, single-maintainer projects. That is precisely the profile the tj-actions attacker exploited.

Why Dependabot is required, not optional

SHA pinning on its own is a security regression over time. It freezes you on a specific commit, so upstream security fixes never arrive. Pinning without automation trades a live risk for a slow one.

The current state of this repo shows exactly how that decay happens even with floating tags:

Action Uses Current Latest
actions/checkout v4.4.0 v7.0.1
actions/setup-node v4.4.0 v7.0.0
actions/create-github-app-token v2.2.2 v3.2.0
kforeverisback/check-crlf-extended v2 v2 ✅
tibdex/github-app-token v1.8.2 v2.1.0 ⚠️ archived upstream
JamesIves/github-pages-deploy-action 4.1.1 v4.9.0

Five of six are a major version behind — actions/checkout and actions/setup-node by three majors.

Deliberately, this PR does not bump any of those versions. Each one is a reviewable decision, and Dependabot will raise them individually as PRs so maintainers can take them at their own pace.

Cost: none

Dependabot does not consume Actions minutes. From GitHub's Dependabot runner documentation:

Running Dependabot on standard GitHub-hosted or self-hosted runners does not count towards your included GitHub Actions minutes.

The only exception is larger runners, which this config does not use. This repository is public, where standard runners are free regardless. There is no billing impact.

Config

Weekly on Monday. Minor and patch updates are grouped into a single PR; major bumps are never grouped and always arrive individually, so the risky upgrades stay reviewable one at a time.

tibdex/github-app-token is ignored. That pin is intentional: 7c77646 switched deploy.yml to actions/create-github-app-token@v2, and 5c2520c reverted it three days later. The ignore stops Dependabot from re-litigating a decision that was already made, and the reason is recorded inline so the next person doesn't undo it.

@jogerj

jogerj commented Sep 5, 2026

Copy link
Copy Markdown
Author

TL;DR I added dependabot and pinned every action to SHA commit. Please check if the current configuration of dependabot is acceptable :)

Oh, also when merged, we can enable "Require actions to be pinned to a full-length commit SHA" under https://github.com/iptv-org/database/settings/actions

Next, on the issue of migrating to actions/create-github-app-token jogerj#1

@freearhey freearhey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore the CRLF line endings in all files.

Pin every action reference to the full commit SHA that its current tag
already resolves to, with the version kept in a trailing comment. No action
changes version as a result of this commit -- the pins are byte-equivalent
to what the floating tags point at today. Version bumps are left to
Dependabot so they arrive as reviewable PRs.

Add .github/dependabot.yml for the github-actions ecosystem: weekly on
Monday, minor/patch grouped into a single PR (majors always get their own),
"ci" commit prefix. tibdex/github-app-token is ignored -- 7c77646 switched
deploy.yml to actions/create-github-app-token@v2 and 5c2520c reverted it
three days later, so that pin is deliberate.
@jogerj

jogerj commented Sep 6, 2026

Copy link
Copy Markdown
Author

@freearhey if line endings matter that much, please consider introducing a .gitattributes file to all repos. This saves time for all collaborators

@jogerj
jogerj force-pushed the ci/pin-actions-dependabot branch from b212c56 to ff9ce0f Compare September 6, 2026 12:33
@freearhey

Copy link
Copy Markdown
Contributor

@jogerj There had been previous attempts to use .gitattributes, but this only resulted in more mess. Here is the last one from epg repository: iptv-org/epg#3247

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are limited to immutable SHA pinning and a valid Dependabot configuration, with no behavioral logic changes to workflows.

Pull request overview

Pins GitHub Actions used in this repository’s CI workflows to immutable full-length commit SHAs and adds a Dependabot configuration to keep those pins updated over time, improving supply-chain security without changing runtime behavior.

Changes:

  • Replace floating action tags (e.g., @v4) with full-length commit SHA pins across the existing workflows (keeping the same resolved versions via comments).
  • Add .github/dependabot.yml to check github-actions weekly and group minor/patch updates while leaving major updates ungrouped.
  • Configure Dependabot to ignore tibdex/github-app-token updates per the documented rationale.
File summaries
File Description
.github/workflows/validate_label.yml Pin actions/checkout and actions/create-github-app-token to SHAs.
.github/workflows/validate_issue.yml Pin actions/checkout, actions/create-github-app-token, and actions/setup-node to SHAs.
.github/workflows/update.yml Pin action references (create-github-app-token, checkout, setup-node, check-crlf-extended) to SHAs.
.github/workflows/deploy.yml Pin tibdex/github-app-token, checkout, setup-node, and github-pages-deploy-action to SHAs.
.github/workflows/check.yml Pin actions/checkout, actions/setup-node, and check-crlf-extended to SHAs.
.github/dependabot.yml Add weekly Dependabot updates for github-actions, grouping minor/patch updates and ignoring tibdex/github-app-token.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants